package java5.io;

public class Posiciones implements Constantes {

    public int[] vacio() {
        return new int[]{vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio};
    }

    public int[] inicio() {

        return this.voltearFilas(new int[]{rook, knight, bishop, queen,
                    king, bishop, knight, rook, pawn, pawn, pawn, pawn, pawn, pawn,
                    pawn, pawn, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, vacio, PAWN, PAWN,
                    PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, ROOK, KNIGHT, BISHOP,
                    QUEEN, KING, BISHOP, KNIGHT, ROOK});

        // return this.voltearColumnas(
        // new int[]{
        // ROOK, KNIGHT, BISHOP, KING, QUEEN, BISHOP, KNIGHT, ROOK,
        // PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN,
        // vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
        // vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
        // vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
        // vacio, vacio, vacio, vacio, vacio, vacio, vacio, vacio,
        // pawn, pawn, pawn, pawn, pawn, pawn, pawn, pawn,
        // rook, knight, bishop, king, queen, bishop, knight, rook,});
    }

    public int[] valid4() {
        return new int[]{ROOK, KNIGHT, BISHOP, vacio, KING, BISHOP, KNIGHT,
                    ROOK, PAWN, PAWN, vacio, vacio, vacio, vacio, vacio, PAWN,
                    vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio,
                    vacio, vacio, pawn, vacio, vacio, vacio, vacio, pawn, vacio,
                    vacio, vacio, vacio, vacio, vacio, pawn, vacio, vacio, QUEEN,
                    vacio, pawn, vacio, pawn, rook, knight, bishop, queen, king,
                    bishop, knight, rook};
    }

    public int[] valid5() {
        return new int[]{
                    ROOK, KNIGHT, BISHOP, vacio, KING, BISHOP, KNIGHT, ROOK,
                    PAWN, PAWN, vacio, vacio, vacio, vacio, vacio, PAWN,
                    vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, PAWN, vacio,
                    vacio, vacio, vacio, vacio, pawn, vacio, vacio, vacio,
                    vacio, pawn, vacio, vacio, vacio, vacio, vacio, vacio,
                    pawn, vacio, vacio, knight, vacio, pawn, vacio, pawn,
                    rook, vacio, bishop, queen, king, bishop, knight, rook};
    }

    public int[] valid6() {
        return new int[]{ROOK, KNIGHT, BISHOP, vacio, KING, BISHOP, KNIGHT,
                    ROOK, PAWN, PAWN, vacio, vacio, vacio, vacio, vacio, PAWN,
                    vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio,
                    vacio, vacio, pawn, vacio, vacio, vacio, vacio, pawn, vacio,
                    vacio, vacio, vacio, vacio, vacio, pawn, vacio, vacio, bishop,
                    vacio, pawn, vacio, pawn, rook, knight, vacio, queen, king,
                    bishop, knight, rook};
    }

    public int[] valid7() {
        return new int[]{ROOK, vacio, BISHOP, KING, vacio, BISHOP, KNIGHT, ROOK,
                    PAWN, PAWN, vacio, KNIGHT, vacio, vacio, vacio, PAWN,
                    vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, vacio, PAWN, vacio,
                    vacio, vacio, vacio, vacio, pawn, vacio, vacio, vacio,
                    vacio, pawn, vacio, vacio, vacio, vacio, vacio, vacio,
                    pawn, vacio, vacio, queen, vacio, pawn, vacio, pawn,
                    rook, knight, bishop, vacio, king, bishop, knight, rook};
    }

    public int[] valid8() {
        return new int[]{ROOK, KNIGHT, BISHOP, vacio, KING, BISHOP, KNIGHT,
                    ROOK, PAWN, PAWN, vacio, vacio, vacio, vacio, vacio, PAWN,
                    vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio, vacio,
                    vacio, vacio, vacio, vacio, vacio, PAWN, vacio, vacio, vacio,
                    vacio, vacio, pawn, vacio, vacio, vacio, vacio, pawn, vacio,
                    vacio, vacio, vacio, vacio, vacio, pawn, vacio, vacio, king,
                    vacio, pawn, vacio, pawn, rook, knight, bishop, queen, vacio,
                    bishop, knight, rook};
    }

    public int[] temp() {
        return this.voltearFilas(new int[]{
                    vacio,vacio,vacio,vacio,king,bishop,vacio,rook,
                    vacio,vacio,vacio,vacio,knight,vacio,pawn,pawn,
                    vacio,vacio,vacio,vacio,vacio,vacio,vacio,vacio,
                    vacio,vacio,vacio,vacio,vacio,pawn,vacio,vacio,
                    vacio,vacio,queen,vacio,vacio,vacio,vacio,vacio,
                    vacio,vacio,vacio,vacio,vacio,vacio,vacio,vacio,
                    vacio,vacio,vacio,PAWN,PAWN,PAWN,PAWN,PAWN,
                    vacio,vacio,BISHOP,QUEEN,KING,BISHOP,KNIGHT,ROOK,
        });
    }
    
    public int[] temp2() {
        return this.voltearFilas(new int[]{
                    vacio,vacio,vacio,vacio,king,bishop,vacio,rook,
                    vacio,vacio,vacio,vacio,knight,vacio,pawn,pawn,
                    vacio,vacio,vacio,vacio,vacio,vacio,vacio,vacio,
                    vacio,vacio,vacio,vacio,vacio,pawn,vacio,vacio,
                    vacio,vacio,vacio,vacio,PAWN,vacio,vacio,vacio,
                    queen,vacio,vacio,vacio,vacio,vacio,vacio,vacio,
                    vacio,vacio,vacio,PAWN,vacio,PAWN,PAWN,PAWN,
                    vacio,vacio,vacio,vacio,KING,BISHOP,KNIGHT,ROOK,
        });
    }

    private int[] voltearColumnas(int[] t) {
        int[] x = new int[64];

        for (int i = 0; i < 64; i++) {
            x[i] = t[(8 * (i / 8 + 1) - 1) - i % 8];
        }

        return x;
    }

    private int[] voltearFilas(int[] t) {
        int[] x = new int[64];

        for (int i = 0; i < 64; i++) {
            x[i] = t[(56 - (i / 8) * 8) + i % 8];
        }

        return x;
    }
}
